<script setup lang="ts">
import { getArtCateApi } from '@/apis/article';
import type { IArticleCate } from '@/types/articles';
import { ElMessage } from 'element-plus';
import { ref } from 'vue';

// 获取文章分类
const artCateList = ref<IArticleCate[]>([])
const getArtCate = async () => {
    const res = await getArtCateApi()
    if (res.status !== 200) {
        return
    }
    artCateList.value = res.data

}
getArtCate()
</script>

<template>
    <div class="side-bar">
        <el-menu default-active="1" router>
            <el-menu-item>分类</el-menu-item>
            <el-menu-item v-for="(item, index) in artCateList" :key="item.id" :index="item.alias">{{ item.name
                }}</el-menu-item>
        </el-menu>
    </div>
</template>

<style scoped>
.side-bar {
    height: calc(100vh - 60px);
    overflow-y: auto;
}
</style>